package common;

import java.util.List;

public class BasicAgentImpl<Genotype> implements BasicAgent<Genotype> {
    
    private Genotype genotype;
    private List<Double> values;
    private List<Double> fitnesses;
    
    public BasicAgentImpl(GeneticOperations<Genotype> go, Genotype aGenotype) {
        this.genotype = aGenotype;
        this.values = go.getValues(this.genotype);
        this.fitnesses = go.getFitnessesFromValue(this.values);
    }

    @Override
    public int checkDomination(BasicAgent<Genotype> agent) {
        return GeneticHelper.checkDomination(this, agent);
    }

    @Override
    public double getFitness(int index) {
        return fitnesses.get(index);
    }

    @Override
    public List<Double> getFitnesses() {
        return fitnesses;
    }

    @Override
    public Genotype getGenotype() {
        return genotype;
    }

    @Override
    public double getValue(int index) {
        return values.get(index);
    }

    @Override
    public List<Double> getValues() {
        return values;
    }

}
